<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<title>Dashboard Template for Bootstrap</title>
	<link rel="stylesheet" type="text/css" href="/xiaomi/Public/css/type.css" />
	<script src="/xiaomi/Public/js/jquery.min.js"></script>
</head>
<body class="admin_layout">
<header class="admin_header">
	<h2>小米商城后台管理系统</h2> 
  <ul>
		<li>欢迎您：</li>
		<li><a href="/xiaomi/index.php?s=/Admin/Administrator/modifySellerInformation"><?php echo ($_SESSION['admin_name']); ?>&emsp;</a></li>
		<li>|</li>
		<li><a href="/xiaomi/index.php?s=">&emsp;前台首页&emsp;</a></li>
		<li>|</li>
		<li><a href="/xiaomi/index.php?s=/Admin/Administrator/logout"  onClick="return confirm('您确定要退出本站?');">&emsp;退出登录&emsp;</a></li>
	</ul>
  
</header>


<div class="admin_main">
<aside class="sidebar" id="selector">
	<ul>
		<li><a href="/xiaomi/index.php?s=/Admin/Index/index" id="">后台首页</a></li>
		<li><a href="/xiaomi/index.php?s=/Admin/Goodcategory/index" id="">分类管理</a></li>
		<li><a href="/xiaomi/index.php?s=/Admin/Goodattribute/checkGoodAttribute" id="">商品属性</a></li>
		<li><a href="/xiaomi/index.php?s=/Admin/Goods/checkGoods" id="">商品管理</a></li>
		<li><a href="/xiaomi/index.php?s=/Admin/Goods/recycleIndex" id="">下架商品</a></li>
		<li><a href="/xiaomi/index.php?s=/Admin/Order/index" id="">订单管理</a></li>
		<li><a href="/xiaomi/index.php?s=/Admin/Orderdetail/index" id="">评论管理</a></li>
	<li><a href="/xiaomi/index.php?s=/Admin/User/index" id="">顾客管理</a></li>
</ul>
</aside>
<section class="admin_section">
	<div>
	<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Module Management</title>
<link rel="stylesheet" type="text/css" href="/xiaomi/Public/css/type.css" />
<script type="text/javascript" src="/xiaomi/Public/js/admin.js"></script>
</head>
<script>
	$(function(){
		$("select").change(function(){
			window.location.href = "/xiaomi/index.php?s=/Admin/Goodattribute/checkGoodAttribute/GoodcategoryId/" + $(this).val();
		});
	});
</script>
<body>
<br>
<br>
<form method="post"
	action="/xiaomi/index.php?s=/Admin/Goodattribute/delSelect/GoodcategoryId/<?php echo ($GoodcategoryId); ?>">
<table class="classify_table1">
	<tr>
		<td><span class="classify_table_title">
		属性管理</span> <span
			class="classify_table_button">
		<input type="button" id="delselect_btn" value="删除">
		</span> <span class="classify_table_button">
		<button><a
			href="/xiaomi/index.php?s=/Admin/Goodattribute/addGoodAttribute/GoodcategoryId/<?php echo ($GoodcategoryId); ?>">添加</a>
		</button>
		</span></td>
	</tr>
	<tr>
		<td>
		<table class="classify_table2">
			<tr>
				<td class="classify_thead_checkbox">
					<input type="checkbox" onclick="DoCheck()" id="allChecked"></td>
				<td class="classify_thead_title">商品分类 <select
					name="GoodcategoryId">
					<option value="0">全部</option>
					<?php if(empty($goodcategory)): ?><option value="-1">未选择</option><?php endif; ?>
					<?php if(is_array($goodcategory)): foreach($goodcategory as $key=>$v): ?><option value="<?php echo ($v["GoodcategoryId"]); ?>"<?php if(($v["GoodcategoryId"]) == $GoodcategoryId): ?>selected<?php endif; ?>
					><?php echo str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;',$v['deep']).$v['CategoryName'];?></option><?php endforeach; endif; ?>
				</select></td>
				<td class="classify_thead_title">属性名</td>
				<td class="classify_thead_title">默认属性值</td>
				<td class="classify_thead_title" col=>编辑</td>

			</tr>


			<?php if(is_array($goodattribute)): foreach($goodattribute as $key=>$v): ?><tr>
				<td class="classify_thead_checkbox"><input type="checkbox"
					name="attributeids[]" value="<?php echo ($v["GoodAttributeid"]); ?>" class="choose"></td>
				<td class="classify_tbody"><?php echo ($v["CategoryName"]); ?></td>
				<td class="classify_tbody"><?php echo ($v["AttributeName"]); ?></td>
				<td class="classify_tbody"><?php echo ($v["AttributeDefVal"]); ?></td>
				<td>
				<button><a
					href="/xiaomi/index.php?s=/Admin/Goodattribute/modifyGoodAttribute/GoodAttributeid/<?php echo ($v["GoodAttributeid"]); ?>/GoodcategoryId/<?php echo ($v["GoodcategoryId"]); ?>">修改</a></button>
				<button><a href="#"
					onclick="del(<?php echo ($v["GoodAttributeid"]); ?>,<?php echo ($v["GoodcategoryId"]); ?>)">删除</a></button>
				</td>

			</tr><?php endforeach; endif; ?>
		</table>
		</td>
	</tr>
</table>
</form>
<script>
//删除时使用
function del(obj,id) {
		if(confirm('删除属性后，各商品中的该属性也将被删除，确定删除本属性?'))
		{
			window.location.href="/xiaomi/index.php?s=/Admin/Goodattribute/deleteGoodAttribute/GoodAttributeid/<?php echo ($v["GoodAttributeid"]); ?>/GoodcategoryId/<?php echo ($v["GoodcategoryId"]); ?>"
		}
	}
$('#delselect_btn').click(function(){
	if($(".choose:checked").length<=0){
		alert("勾选至少一个属性复选框，才能进行本操作！");
		retrun;}
	if(confirm('删除属性后，各商品中的该属性也将被删除，确定删除这些属性?'))
	{
		$('form').submit();
	}

});

</script>
</body>
</html>
	</div>
</section>
</div>
</body>
</html>